<template>
    <div class="scrollbar" style="width: 22vw; height: 100vh; color: white; background-color: ;overflow-y:scroll">
        <div style="margin-top: 10vh; background-color: #fff;color:#000000">
            <span style="margin-left: 20px; padding: 10px">{{type}}</span>
        </div>
        <div>
            <el-tree
                class="treeStyle"
                style=""
                :data="enterpriseData"
                default-expanded-keys:
                node-key="id"
                :props="defaultProps"
                @node-click="handleNodeClick"
            >
                <span class="custom-tree-node" slot-scope="{ node, data }">
                    <span >{{ data.abbreviation }}</span>
                    <span>
                        <el-button type="text" size="mini" @click="append(data)"> </el-button>
                        <el-button type="text" size="mini" @click="remove(node, data)"> </el-button>
                    </span>
                </span>
            </el-tree>
        </div>
    </div>
</template>
<script>
export default {
    data() {
        return {
            defaultProps: {
                children: 'arr2',
                label: 'abbreviation',
            },
            type: '地块名称',
        };
    },
    props: {
        enterpriseData: Array
    },
    computed: {},
    methods: {
        handleNodeClick(data) {
            let datas = JSON.parse(data.coordinate)
            this.$emit("change",data)
        },
    },
    mounted() {
        // this.init()
        var userTypes = JSON.parse(localStorage.getItem('userInfo'))
        if(userTypes.userInfo.userType == "GOV"){
            this.type = "企业列表"
        }else{
            // this.dataplane = false
            this.type = "地块名称"
        }
    },
    created() {}
};
</script>
<style scoped lang="less">
.treeStyle {
    background-color: rgba(3, 3, 3, 0);
    color: #000000;
}
/deep/ .el-tree-node__content:hover {
    background: white;
    color: #000000;
}
/deep/ .el-tree-node:focus > .el-tree-node__content {
    background-color: white;
    color: #000000;
}
&::-webkit-scrollbar {
  width: 1px;
  background-color: rgba(0, 118, 255, 0);
  height: 14px;
}
</style>
